/*
 * @author zzr
 * @date: 2025/05/06  20:33
 * @description: 饿汉模式解决三个问题后的版本
 */
class SingletonLazy2 {

    private static volatile SingletonLazy2 instance = null;
    static Object locker = new Object();

    public static SingletonLazy2 getInstance() {

        if (null == instance) {
            synchronized (locker) {
                if (null == locker) {
                    instance = new SingletonLazy2();
                }
            }
        }
        return instance;
    }
}
public class Demo2_2 {
}
